import { Button } from "antd";
import React, { memo } from "react";
import { useNavigate } from "react-router-dom";

import { ExitWrapper } from "./style";

const Exit = memo(() => {
  const navigate = useNavigate();

  const exit = () => {
    localStorage.removeItem("token");
    navigate("/login");
  };

  return (
    <ExitWrapper>
      <Button onClick={() => exit()} className="btn" size="large">
        退出登录
      </Button>
    </ExitWrapper>
  );
});

export default Exit;
